package Year21_Month11.day1109;

public class Soultion2 {
    public static int minArray(int[] numbers) {
        if(numbers == null || numbers.length == 0){
            return -1;
        }
        int right = numbers.length -1;
        int left = 0;
        int mid = (left + right) / 2;
        if(numbers[right] <= numbers[mid] && numbers[mid] <= numbers[left]){
            return right;
        }
        while(left < right){
            mid = (right + right) >> 1;
            if(numbers[right] > numbers[mid]){
                right = mid;
            }else{
                left = mid;
            }
        }
        return numbers[right];
    }

    public static void main(String[] args) {
        int[] a = {1,3,5};
        System.out.println(minArray(a));
    }
}
